package com.johnguo.carbondata_demo;

import java.util.Scanner;

import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.apache.spark.sql.CarbonContext;

public class SqlCarbonData {
	public static final Scanner scanner = new Scanner(System.in);
	public static void main(String...args) {
		SparkConf conf = new SparkConf().setAppName("SqlCarbonData");
		SparkContext sc = new SparkContext(conf);
		CarbonContext cc = new CarbonContext(sc, "hdfs://master:9000/usr/cardata");
		while(true) {
			try {
				System.out.print("输入sql语句：");
				String sql = scanner.nextLine();
				cc.sql(sql).show();
			} catch(Exception ex) {
				ex.printStackTrace();
			}
		}
	}
}
